package com.zd;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class GroupRandomPicker {
    public static void main(String[] args) {
        // 创建教室和小组的映射列表
        List<Classroom> classrooms = new ArrayList<>();
        classrooms.add(new Classroom("中2313教室", 15));
        classrooms.add(new Classroom("中3303教室", 8));
        classrooms.add(new Classroom("中3402教室", 7));
        classrooms.add(new Classroom("中2414教室", 15));
        classrooms.add(new Classroom("中3405教室", 8));
        classrooms.add(new Classroom("中2413教室", 15));
        classrooms.add(new Classroom("中3302教室", 8));

        // 随机选择一个教室
        Random random = new Random();
        Classroom selectedClassroom = classrooms.get(random.nextInt(classrooms.size()));

        // 随机选择该教室中的一个小组
        int selectedGroup = random.nextInt(selectedClassroom.getGroupCount()) + 1;

        // 输出结果
        System.out.println("随机选择的小组是：" + selectedClassroom.getName() + "的" + selectedGroup + "号小组");
    }

    // 教室类，包含教室名称和小组数量
    static class Classroom {
        private String name;
        private int groupCount;

        public Classroom(String name, int groupCount) {
            this.name = name;
            this.groupCount = groupCount;
        }

        public String getName() {
            return name;
        }

        public int getGroupCount() {
            return groupCount;
        }
    }
}